#ifndef _RINGBUFFER_H_
#define _RINGBUFFER_H_

#include <stdint.h>
#include <stdlib.h>

#define DATA_SIZE 13
#define MAX_COUNT 10

typedef struct blkbuf_s
{
    uint8_t data[DATA_SIZE];
    struct blkbuf_s *pnext;
} blkbuf_t;

typedef struct ringblkbuf_s
{
    blkbuf_t buf[MAX_COUNT];
    blkbuf_t *phead;
    blkbuf_t *ptail;
    uint32_t current_count;
} ringblkbuf_t;

void ringblkbuf_init(ringblkbuf_t *prbb);
uint8_t ringblkbuf_read(ringblkbuf_t *prbb,uint8_t *pdata, uint8_t len);
uint8_t ringblkbuf_write(ringblkbuf_t *prbb,uint8_t *pdata,uint8_t len);

#endif
